#tag Module
Protected Module PopupMenuExtension
	#tag Method, Flags = &h0
		Function ArrowPosition(Extends p as PopupMenu) As NSPopupArrowPosition
		  
		  #if TargetCocoa
		    
		    declare function arrowPosition lib CocoaLib selector "arrowPosition" (obj_id as Ptr) as NSPopUpArrowPosition
		    
		    return arrowPosition(p.PopUpButtonCell)
		    
		  #else
		    
		    #pragma unused p
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub ArrowPosition(Extends p as PopupMenu, Assigns value as NSPopupArrowPosition)
		  
		  #if TargetCocoa
		    
		    declare sub setArrowPosition lib CocoaLib selector "setArrowPosition:" (obj_id as Ptr, value as NSPopupArrowPosition)
		    
		    setArrowPosition(p.PopUpButtonCell, value)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused value
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function AutoenablesItems(Extends p as PopupMenu) As Boolean
		  
		  #if TargetCocoa
		    
		    declare function autoenablesItems lib CocoaLib selector "autoenablesItems" (obj_id as Integer) as Boolean
		    
		    return autoenablesItems(p.handle)
		    
		  #else
		    
		    #pragma unused p
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub AutoenablesItems(Extends p as PopupMenu, assigns value as Boolean)
		  
		  #if TargetCocoa
		    
		    declare sub setAutoenablesItems lib CocoaLib selector "setAutoenablesItems:" (obj_id as Integer, value as Boolean)
		    
		    setAutoenablesItems(p.handle, value)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused value
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function BezelStyle(Extends p as PopupMenu) As NSBezelStyle
		  
		  #if TargetCocoa
		    
		    declare function bezelStyle lib CocoaLib selector "bezelStyle" (obj_id as Integer) as NSBezelStyle
		    
		    return bezelStyle(p.handle)
		    
		  #else
		    
		    #pragma unused p
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub BezelStyle(Extends p as PopupMenu, Assigns value as NSBezelStyle)
		  
		  #if TargetCocoa
		    
		    declare sub setBezelStyle lib CocoaLib selector "setBezelStyle:" (obj_id as Integer, value as NSBezelStyle)
		    
		    setBezelStyle(p.handle, value)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused value
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function Bordered(Extends p as PopupMenu) As Boolean
		  
		  #if TargetCocoa
		    
		    declare function isBordered lib CocoaLib selector "isBordered" (obj_id as Integer) as Boolean
		    
		    return isBordered(p.handle)
		    
		  #else
		    
		    #pragma unused p
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub Bordered(Extends p as PopupMenu, Assigns value as Boolean)
		  
		  #if TargetCocoa
		    
		    declare sub setBordered lib CocoaLib selector "setBordered:" (obj_id as Integer, value as Boolean)
		    
		    setBordered(p.handle, value)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused value
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub Icon(extends p as PopupMenu, index as Integer, assigns value as NSImage)
		  
		  #if TargetCocoa
		    
		    declare function menu lib CocoaLib selector "menu" (obj_id as Integer) as Ptr
		    declare function itemAtIndex lib CocoaLib selector "itemAtIndex:" (obj_id as Ptr, index as Integer) as Ptr
		    declare sub setImage lib CocoaLib selector "setImage:" (obj_id as Ptr, menuImage as Ptr)
		    declare sub setSize lib CocoaLib selector "setSize:" (obj_id as Ptr, aSize as Cocoa.NSSize)
		    
		    dim m as Ptr = menu(p.Handle)
		    dim item as Ptr = itemAtIndex(m, index)
		    dim icon as NSImage = value.Copy
		    
		    dim size as Cocoa.NSSize
		    const MenuIconSize = 16
		    size.Width = MenuIconSize
		    size.Height = MenuIconSize
		    setSize(icon, size)
		    
		    setImage(item, icon)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused index
		    #pragma unused value
		    
		  #endif
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function IndexOfItemWithTitle(Extends p as PopupMenu, aTitle as String) As Integer
		  
		  #if TargetCocoa
		    
		    declare function indexOfItemWithTitle lib CocoaLib selector "indexOfItemWithTitle:" (obj_id as Integer, aTitle as CFStringRef) as Integer
		    
		    return indexOfItemWithTitle(p.handle, aTitle)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused aTitle
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Function PopUpButtonCell(Extends p as PopupMenu) As Ptr
		  
		  #if TargetCocoa
		    
		    declare function cell lib CocoaLib selector "cell" (obj_id as Integer) as Ptr
		    
		    return cell(p.handle)
		    
		  #else
		    
		    #pragma unused p
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function PreferredEdge(Extends p as PopupMenu) As NSRectEdge
		  
		  #if TargetCocoa
		    
		    declare function preferredEdge lib CocoaLib selector "preferredEdge" (obj_id as Integer) as NSRectEdge
		    
		    return preferredEdge(p.handle)
		    
		  #else
		    
		    #pragma unused p
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub PreferredEdge(Extends p as PopupMenu, Assigns value as NSRectEdge)
		  
		  #if TargetCocoa
		    
		    declare sub setPreferredEdge lib CocoaLib selector "setPreferredEdge:" (obj_id as Integer, value as NSRectEdge)
		    
		    setPreferredEdge(p.handle, value)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused value
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function PullsDown(Extends p as PopupMenu) As Boolean
		  
		  #if TargetCocoa
		    
		    declare function pullsDown lib CocoaLib selector "pullsDown" (obj_id as Integer) as Boolean
		    
		    return pullsDown(p.handle)
		    
		  #else
		    
		    #pragma unused p
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub PullsDown(Extends p as PopupMenu, assigns value as Boolean)
		  
		  #if TargetCocoa
		    
		    declare sub setPullsDown lib CocoaLib selector "setPullsDown:" (obj_id as Integer, value as Boolean)
		    
		    setPullsDown(p.handle, value)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused value
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub SelectItemWithTitle(Extends p as PopupMenu, aTitle as String)
		  
		  #if TargetCocoa
		    
		    declare sub selectItemWithTitle lib CocoaLib selector "selectItemWithTitle:" (obj_id as Integer, aTitle as CFStringRef)
		    
		    selectItemWithTitle(p.handle, aTitle)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused aTitle
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub SetTitle(Extends p as PopupMenu, aTitle as String)
		  
		  #if TargetCocoa
		    
		    declare sub setTitle lib CocoaLib selector "setTitle:" (obj_id as Integer, aTitle as CFStringRef)
		    
		    setTitle(p.handle, aTitle)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused aTitle
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function ShowsBorderOnlyWhileMouseInside(Extends p as PopupMenu) As Boolean
		  
		  #if TargetCocoa
		    
		    declare function showsBorderOnlyWhileMouseInside lib CocoaLib selector "showsBorderOnlyWhileMouseInside" (obj_id as Integer) as Boolean
		    
		    return showsBorderOnlyWhileMouseInside(p.handle)
		    
		  #else
		    
		    #pragma unused p
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub ShowsBorderOnlyWhileMouseInside(Extends p as PopupMenu, Assigns value as Boolean)
		  
		  #if TargetCocoa
		    
		    declare sub setShowsBorderOnlyWhileMouseInside lib CocoaLib selector "setShowsBorderOnlyWhileMouseInside:" (obj_id as Integer, value as Boolean)
		    
		    setShowsBorderOnlyWhileMouseInside(p.handle, value)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused value
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub SynchronizeTitleAndSelectedItem(Extends p as PopupMenu)
		  
		  #if TargetCocoa
		    
		    declare sub synchronizeTitleAndSelectedItem lib CocoaLib selector "synchronizeTitleAndSelectedItem" (obj_id as Integer)
		    
		    synchronizeTitleAndSelectedItem(p.handle)
		    
		  #else
		    
		    #pragma unused p
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function Transparent(Extends p as PopupMenu) As Boolean
		  
		  #if TargetCocoa
		    
		    declare function isTransparent lib CocoaLib selector "isTransparent" (obj_id as Integer) as Boolean
		    
		    return isTransparent(p.handle)
		    
		  #else
		    
		    #pragma unused p
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub Transparent(Extends p as PopupMenu, Assigns value as Boolean)
		  
		  #if TargetCocoa
		    
		    declare sub setTransparent lib CocoaLib selector "setTransparent:" (obj_id as Integer, value as Boolean)
		    
		    setTransparent(p.handle, value)
		    
		  #else
		    
		    #pragma unused p
		    #pragma unused value
		    
		  #endif
		  
		End Sub
	#tag EndMethod


	#tag Enum, Name = NSBezelStyle, Flags = &h0
		NSRoundedBezelStyle = 1
		  NSRegularSquareBezelStyle
		  NSThickSquareBezelStyle
		  NSThickerSquareBezelStyle
		  NSDisclosureBezelStyle
		  NSShadowlessSquareBezelStyle
		  NSCircularBezelStyle
		  NSTexturedSquareBezelStyle
		  NSHelpButtonBezelStyle
		  NSSmallSquareBezelStyle
		  NSTexturedRoundedBezelStyle
		  NSRoundRectBezelStyle
		  NSRecessedBezelStyle
		  NSRoundedDisclosureBezelStyle
		  NSInlineBezelStyle
		NSSmallIconButtonBezelStyle = 2
	#tag EndEnum

	#tag Enum, Name = NSPopUpArrowPosition, Flags = &h0
		NSPopUpNoArrow
		  NSPopUpArrowAtCenter
		NSPopUpArrowAtBottom
	#tag EndEnum

	#tag Enum, Name = NSRectEdge, Flags = &h0
		NSMinXEdge
		  NSMinYEdge
		  NSMaxXEdge
		NSMaxYEdge
	#tag EndEnum


	#tag ViewBehavior
		#tag ViewProperty
			Name="Index"
			Visible=true
			Group="ID"
			InitialValue="-2147483648"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Left"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Name"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Super"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Top"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
	#tag EndViewBehavior
End Module
#tag EndModule
